/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.wii.elpro.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;

/**
 *
 * @author hendro
 */
@Entity
public class Inquery implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @Column(name="no_quotation",length=20)
    private String noQuotation;
    @Temporal(value = javax.persistence.TemporalType.DATE)
    private Date tanggal;
    @ManyToOne
    @JoinColumn(name = "user_id")
    private User sales;
    @ManyToOne
    @JoinColumn(name = "project_id")
    private Project project;
    @ManyToOne
    @JoinColumn(name = "prodspec_id")
    private ProductSpecification productSpec;
    @ManyToOne
    @JoinColumn(name = "stanspec_id")
    private StandartSpecification standartSpec;
    @ManyToOne
    @JoinColumn(name = "finishing_id")
    private Finishing finishing;
    @ManyToOne
    @JoinColumn(name = "kontraktor_id")
    private BusinessPartner kontraktor;
    @ManyToOne
    @JoinColumn(name = "konsultan_id")
    private BusinessPartner konsultan;
    @Column(name = "alamat", length = 200)
    private String alamat;
    @OneToMany
    private List<InqueryItem> items = new ArrayList<InqueryItem>();
    @ManyToOne
    @JoinColumn(name="cabang_id")
    private Cabang cabang;    
    @ManyToOne
    @JoinColumn(name="quotation_id")
    private Quotation quotation;
    

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Inquery)) {
            return false;
        }
        Inquery other = (Inquery) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.wii.elpro.entity.Inquery[id=" + id + "]";
    }

    public Date getTanggal() {
        return tanggal;
    }

    public void setTanggal(Date tanggal) {
        this.tanggal = tanggal;
    }

    public User getSales() {
        return sales;
    }

    public void setSales(User sales) {
        this.sales = sales;
    }

    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    public ProductSpecification getProductSpec() {
        return productSpec;
    }

    public void setProductSpec(ProductSpecification productSpec) {
        this.productSpec = productSpec;
    }

    public StandartSpecification getStandartSpec() {
        return standartSpec;
    }

    public void setStandartSpec(StandartSpecification standartSpec) {
        this.standartSpec = standartSpec;
    }

    public Finishing getFinishing() {
        return finishing;
    }

    public void setFinishing(Finishing finishing) {
        this.finishing = finishing;
    }

    public BusinessPartner getKontraktor() {
        return kontraktor;
    }

    public void setKontraktor(BusinessPartner kontraktor) {
        this.kontraktor = kontraktor;
    }

    public BusinessPartner getKonsultan() {
        return konsultan;
    }

    public void setKonsultan(BusinessPartner konsultan) {
        this.konsultan = konsultan;
    }

    public String getAlamat() {
        return alamat;
    }

    public void setAlamat(String alamat) {
        this.alamat = alamat;
    }

    public List<InqueryItem> getItems() {
        return items;
    }

    public void setItems(List<InqueryItem> items) {
        this.items = items;
    }

    public Cabang getCabang() {
        return cabang;
    }

    public void setCabang(Cabang cabang) {
        this.cabang = cabang;
    }

    public Quotation getQuotation() {
        return quotation;
    }

    public void setQuotation(Quotation quotation) {
        this.quotation = quotation;
    }

    public String getNoQuotation() {
        return noQuotation;
    }

    public void setNoQuotation(String noQuotation) {
        this.noQuotation = noQuotation;
    }
}
